home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1998 July / EnigmA AMIGA RUN 29 (1998)(G.R. Edizioni)(IT)[!][issue 1998-07 & 08].iso / recent / iib122.lha / IIB / Threads / Additional / IARexx.lha / SpiralLite.irx < prev    next >
Text File  |  1997-03-19  |  4KB  |  157 lines

  1. /*
  2.           Imagine5.0 Arexx Spiral Lightsource Creator
  3.  
  4.               "What use it is, I'll never know !!"
  5.  
  6.                              :-)
  7.  
  8.              1996 Rob Darke - Freely distributable
  9.     robda@parallel.demon.co.uk  or  iml@parallel.demon.co.uk
  10.  
  11. */
  12.  
  13. ADDRESS 'Imagine.1'
  14.  
  15. NL = '0A'x
  16.  
  17. IF ~EXISTS('LIBS:rexxreqtools.library') THEN DO
  18.    NOTIFY 'Please install the rexxreqtools.library into your LIBS: directory'
  19.    NOTIFY 'It is available from /pub/aminet/util/rexx/RexxReqTools.lha'
  20.    exit
  21. END
  22. CALL ADDLIB('rexxreqtools.library',0,-30,0)
  23.  
  24. IF ~EXISTS('LIBS:rexxmathlib.library') THEN DO
  25.   CALL rtezrequest('Please install the rexxmathlib.library into your LIBS: directory' || NL || NL ||,
  26.                    'The library is available from pub/aminet/util/rexx/RexxMathLib1.3.lha','Great, thanks!','Go get RexxMathLib.library','rt_reqpos = reqpos_centerscr')
  27.   exit
  28. END
  29. CALL ADDLIB('rexxmathlib.library',0,-30,0)
  30.  
  31. DISPLAYREXXPTR ON
  32.  
  33. CALL rtezrequest('Spiral Lightsource Creator -  1996 Rob Darke','Wow!','Spiral Litez','rt_reqpos = reqpos_centerscr')
  34.  
  35. radius = rtgetlong(25,'Enter spiral radius','Spiral Radius',,'rt_reqpos = reqpos_centerscr')
  36.  
  37. if ~rtresult then CALL desist
  38.  
  39. distance = rtgetlong(100,'Enter spiral length','Spiral Length',,'rt_reqpos = reqpos_centerscr')
  40.  
  41. if ~rtresult then CALL desist
  42.  
  43. angle = rtgetlong(720,'Enter total rotation angle','Spiral Rotation',,'rt_reqpos = reqpos_centerscr')
  44.  
  45. if ~rtresult then CALL desist
  46.  
  47. lights = 0
  48. do while (lights = 0)
  49.    lights = rtgetlong(20,'Enter number of lightsources','Total Lightsources',,'rt_reqpos = reqpos_centerscr')
  50. end
  51.  
  52. if ~rtresult then CALL desist
  53.  
  54. totalred = rtgetlong(255,'Enter overall RED light level','Lightsource values',,'rt_reqpos = reqpos_centerscr')
  55.  
  56. if ~rtresult then CALL desist
  57.  
  58. totalgreen = rtgetlong(255,'Enter overall GREEN light level','Lightsource values',,'rt_reqpos = reqpos_centerscr')
  59.  
  60. if ~rtresult then CALL desist
  61.  
  62. totalblue = rtgetlong(255,'Enter overall BLUE light level','Lightsource  values',,'rt_reqpos = reqpos_centerscr')
  63.  
  64. if ~rtresult then CALL desist
  65.  
  66. axesname = rtgetstring('SPIRAL.LITE','Enter base name for light objects','Object name',,'rt_reqpos = reqpos_centerscr')
  67.  
  68. if ~rtresult then CALL desist
  69.  
  70. ret = rtezrequest('I am going to create a spiral set of 'lights' lights' || NL ||,
  71.                   '           Radius = 'radius || NL ||,
  72.                   '           Length = 'distance || NL ||,
  73.                   '         Rotation = 'angle || NL ||,
  74.                   '        Total Red = 'totalred || NL ||,
  75.                   '      Total Green = 'totalgreen || NL ||,
  76.                   '       Total Blue = 'totalblue || NL ||,
  77.                   ' Object base name = 'axesname, ' _Ok | _Abort','Notification','rt_reqpos = reqpos_centerscr')
  78.  
  79. if ~ret then CALL desist
  80.  
  81. ret = rtezrequest('It is imperative that you don`t click anywhere whilst I`m' || NL ||,
  82.                   ' doing this, or else things will go very pear-shaped !!!','_Fair Enough | _Abort','Warning','rt_reqpos = reqpos_centerscr')
  83.  
  84. if ~ret then CALL desist
  85.  
  86. /* All these vars are required by Imagine - change them if you want but  */
  87. /* be sure what you are changing ...                                     */
  88.  
  89. ATTRIB.LIGHT = ON
  90.  
  91. ATTRIB.LIGHT_R = totalred/lights
  92. ATTRIB.LIGHT_G = totalgreen/lights
  93. ATTRIB.LIGHT_B = totalblue/lights
  94.  
  95. ATTRIB.LIGHT_PS = OFF
  96. ATTRIB.LIGHT_PR = ON
  97. ATTRIB.LIGHT_ROUND = OFF
  98. ATTRIB.LIGHT_RECT = OFF
  99. ATTRIB.LIGHT_CS = ON
  100. ATTRIB.LIGHT_SS = OFF
  101. ATTRIB.LIGHT_DI = OFF
  102. ATTRIB.LIGHT_CF = OFF
  103. ATTRIB.LIGHT_NOLF = OFF
  104.  
  105. /* So now lets begin ... won't this be fun ... */
  106.  
  107. singleangle = angle / (lights)
  108. singlestep = distance / (lights-1)
  109.  
  110. pi = 3.141592654
  111. po = (pi * 2)
  112.  
  113. DETAILEDITOR
  114. ZOOM 1
  115. CENTERAT 0 0 0
  116. OBJECTMODE
  117. MULTIPICKOFF
  118.  
  119. do i = 0 to (lights-1)
  120.  
  121.    se = ((((singleangle*i) / 360)*po)-pi)
  122.    x = (radius * sin(se))
  123.    y = (radius * cos(se))
  124.    z = (i * singlestep)
  125.  
  126.    ADDAXIS
  127.    PICK
  128.    TRANSFORM_POSITION x y z
  129.    TRANSFORM_ALIGNMENT 90 0 0
  130.    ATTRIB.OBJECTNAME = axesname'.'i
  131.    SETATTRIBUTES OBJECTNAME
  132.    SETATTRIBUTES LIGHT
  133.  
  134. end
  135.  
  136. ADDAXIS
  137. PICK
  138. TRANSFORM_ALIGNMENT 90 0 0
  139. TRANSFORMA_SIZE 0 (distance+100) 0
  140. ATTRIB.OBJECTNAME = 'GROUP.'axesname
  141. SETATTRIBUTES OBJECTNAME
  142. MULTIPICKON
  143. do i = 0 to (lights-1)
  144.    PICK axesname'.'i
  145. end
  146. MULTIPICKOFF
  147. GROUP
  148. GROUPMODE
  149. DISPLAYREXXPTR OFF
  150. CALL rtezrequest('Job done. Your set of 'lights' spiral lights awaits ...','Thanks Rob!','Spiral Litez','rt_reqpos = reqpos_centerscr')
  151. exit
  152.  
  153. desist: procedure
  154.    DISPLAYREXXPTR OFF
  155.    exit
  156. end
  157.